<?php
session_start();
//parametrii conectare baza de date
$adresa_db = "localhost";
$utilizator_db = "swar";
$parola_db = "";
$db = mysql_connect($adresa_db, $utilizator_db, $parola_db) or die("Nu se poate conecta la baza de date !");
mysql_select_db("swar_db", $db);

if (isset($_SESSION['utilizator']))
{
$user = $_SESSION['utilizator'];
$planeta = $_SESSION['planeta'];
global $user;
global $planeta;
}
else 
{
echo '<meta http-equiv="refresh" content="0; url=index.php?eroare=403">';
exit();
}

$rez_planeta = mysql_fetch_array(mysql_query("SELECT coord_x,coord_y FROM `planete` WHERE user = '".$user."' AND id = '".$planeta."'"));
$coord_x = $rez_planeta["coord_x"];
$coord_y = $rez_planeta["coord_y"];

function addentities($data){
   if(trim($data) != ''){
   $data = htmlentities($data, ENT_QUOTES);
   return str_replace('\\', '&#92;', $data);
   } else return $data;
}

function valoare_mysql($query, $default_value=0) {
    $rezultat = mysql_query($query);
    if (mysql_num_rows($rezultat)==0)
        return $default_value;
    else
        return mysql_result($rezultat,0);
}

?>